Skip to content

Tests: pool delete cleanup and storage-side clone - #66

Merged
roiyz-lb merged 1 commit into
mainfrom
test/coverage-pool-delete-and-clone
Nov 29, 2026
Merged

roiyz-lb merged 1 commit into
mainfrom
test/coverage-pool-delete-and-clone

Conversation

@roiyz-lb

@roiyz-lb roiyz-lb commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

What

Tests for two data paths that had none:

  • Pool delete cleanup (LightbitsLifeCycleDeleteTest). Deleting a pool removes its cached template volumes and the volumes and snapshots named exactly like its objects, including a leftover clone-source snapshot. It leaves alone:

    • a sibling pool in the same project
    • an environment whose name only starts the same
    • names the plugin does not make
    • objects outside the plugin

    An unreachable cluster does not stop the delete. A failed token replacement cleans up with the stored token.

  • Storage-side clone (LightbitsDriverOperationsTest):

    • From a template: a native clone at the larger of the requested and source sizes, with the source's replica count; the empty placeholder is removed; the backing path is saved on the volume row.
    • A failed clone removes the clone-source snapshot it took.
    • From a snapshot: clones that snapshot and never deletes it.
    • A clone across projects is refused before anything is asked of the cluster.

One small seam: the lifecycle reads the pool configuration through a package-private function, so the test runs without the database's encryption. No behaviour change.

Coverage

Line coverage 80.4% to 82.9%, branch coverage 74.9% to 76.6% (gate: 60%). Driver branch coverage 49% to 60%, lifecycle branch coverage 49% to 65%. 413 tests pass on CloudStack 4.22.1.0 and 4.23.0.0.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved cleanup of Lightbits storage objects when pool configuration cannot be loaded, allowing cleanup to continue with the stored access token.
  • Tests
    • Added coverage for cloning from templates and snapshots, including clone failures and requests across different projects or clusters.
    • Added checks that cleanup preserves objects belonging to other pools and handles cluster read failures.

…side clone from a template, volume or snapshot

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@roiyz-lb
roiyz-lb requested a review from ron-lb as a code owner November 29, 2026 09:00
@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The lifecycle cleanup path now loads pool configuration through a loader and retries after an IllegalArgumentException. Tests cover cleanup behavior and storage-side cloning from template, volume, and snapshot sources.

Changes: Pool cleanup

Layer / File(s) Summary
Pool configuration loading and retry
src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/LightbitsPrimaryDataStoreLifeCycle.java, src/test/java/org/apache/cloudstack/storage/datastore/lifecycle/LightbitsLifeCycleDeleteTest.java
The lifecycle adds a pool configuration loader and uses it during cleanup. A test checks that cleanup retries after the first load fails.
Cleanup behavior tests
src/test/java/org/apache/cloudstack/storage/datastore/lifecycle/LightbitsLifeCycleDeleteTest.java
WireMock-backed tests check which pool objects and template references cleanup removes, and how cleanup handles failed cluster reads.

Storage-side clone tests

Layer / File(s) Summary
Clone scenarios and test support
src/test/java/org/apache/cloudstack/storage/datastore/driver/LightbitsDriverOperationsTest.java
The fake cluster records clone parameters and can fail a clone. Tests check template snapshot cleanup, snapshot-source handling, clone sizing and replica counts, and source-pool rejection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Merge Risk: Minimal · up to 71829

This PR mainly adds tests for pool deletion cleanup and storage-side cloning. The one production change is a retry when loading pool configuration during cleanup. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Tests: pool delete cleanup and storage-side clone" names the two areas the changeset tests: pool deletion cleanup (LightbitsLifeCycleDeleteTest, cleanupClusterObjects) and storage-side clon…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Tests: pool delete cleanup and storage-side clone" names the two areas the changeset tests: pool deletion cleanup (LightbitsLifeCycleDeleteTest, cleanupClusterObjects) and storage-side clone (LightbitsDriverOperationsTest). It is specific and matches the PR objectives. It does not mention the small production change to the poolConfig loader, which is expected for a test-focused title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 40c4e11 and 7182965.

Files selected for processing: 3

  • src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/LightbitsPrimaryDataStoreLifeCycle.java
  • src/test/java/org/apache/cloudstack/storage/datastore/driver/LightbitsDriverOperationsTest.java
  • src/test/java/org/apache/cloudstack/storage/datastore/lifecycle/LightbitsLifeCycleDeleteTest.java

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@roiyz-lb

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@roiyz-lb

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@roiyz-lb

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@roiyz-lb

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@roiyz-lb

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@roiyz-lb
roiyz-lb merged commit 1c05695 into main Nov 29, 2026
5 checks passed
@roiyz-lb
roiyz-lb deleted the test/coverage-pool-delete-and-clone branch November 29, 2026 11:27
@roiyz-lb roiyz-lb mentioned this pull request Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant